<template>
  <div class="rules-list" v-bind:style="{ height:rulesListHeight + 'px' }">
    <div class="head clear-float" v-bind:style="{ height:headHeight + 'px' }">
      <el-form :model="formQuery" >
        <el-form-item label="bizType">
          <el-select v-model="formQuery.bizType" filterable placeholder="select please...">
            <el-option
              v-for="bizType in bizTypeList"
              :key="bizType.value"
              :label="bizType.label"
              :value="bizType.value">
            </el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="keyword">
          <el-input v-model="formQuery.keyword">
          </el-input>
        </el-form-item>
      </el-form>
    </div>
    <div class="body" v-bind:style="{ height:bodyHeight + 'px' }">
    </div>
  </div>
</template>

<script>
  export default {
    name: 'RulesList',
    props: [],
    data () {
      return {
        "screenWidth": window.innerWidth,
        "screenHeight": window.innerHeight,
        "bizTypeList":[],
        "formQuery":{},
        "headHeight":166,
        "bodyHeight":0,
        "rulesListHeight":0
      }
    },
    created: function() {
      var that = this;
      this.axios.get('/api/bizTypeList')
        .then(function (response) {
          that.bizTypeList = response.data.dataList;
        });
    },
    mounted: function() {
      var that = this;
      //fullHeight操作
      that.fullHeight();
      window.onresize = () => {
          return (() => {
            window.screenWidth = window.innerWidth;
            that.screenWidth = window.screenWidth;
            window.screenHeight = window.innerHeight;
            that.screenHeight = window.screenHeight;
          })();
      }
    },
    methods: {
      fullHeight: function() {
        var _winHeight = window.innerHeight;
        var _elm = this.$vnode.elm;
        //容器到底
        this.rulesListHeight = _winHeight - _elm.parentElement.parentElement.offsetTop;
        //内容部分做出适应性的操作
        this.bodyHeight = this.rulesListHeight - this.headHeight;
      },
    },
    watch: {
      "screenWidth": function(val) {
        this.fullHeight();
      },
      "screenHeight": function(val) {
        this.fullHeight();
      }
    }
  }
</script>
